Please type your name and hit Enter ? Attila the Hun Your name is: Attila the Hun
The first spaces are skipped, but the spaces inside the string are not skipped.
You can test if two strings are equal by using a relational expression like:
OneString = AnotherString
Here is an example:
' Password checker ' PRINT "Enter the password" INPUT WORD$ IF WORD$ = "SECRET" THEN PRINT "permission granted" ELSE PRINT "permission denied" END IF ' END
The INPUT
statement copies the characters that
the user types into WORD$
.
The relational expression WORD$ = "SECRET"
is TRUE if those characters are exactly the characters in SECRET
(they must be uppercase letters).
Here is a run of the program:
Enter the password ? SECRET permission granted
Say that the user runs the program and enters:
? secret
What will the program write?